chore(lint): report unused eslint-disable directives as errors - #7934
Merged
baozhoutao merged 1 commit intoSep 6, 2026
Merged
Conversation
Add one top-level `linterOptions: { reportUnusedDisableDirectives: 'error' }`
object to `eslint.config.js`. ESLint's own default for the option is already
`'warn'`, so this is a severity change on a check already running (1 -> 2),
inert until now only because `.github/workflows/lint.yml` deliberately sets no
`--max-warnings`.
The object carries only `linterOptions` and no `files` key, which is what makes
it reach every linted path — including the `.js/.mjs/.cjs` family that
`lint:root` walks and that every rule-bearing object in this config skips.
Precondition measured on this branch point, not assumed: all 47 of turbo's lint
tasks run directly with `--report-unused-disable-directives-severity error`
report 0 unused directives (4330 file rows, 0 errors, 11964 warnings).
Part of objectui#4853
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013uAaxiwgYDybsTNV9xwa1M
This was referenced Sep 6, 2026
This was referenced Sep 6, 2026
baozhoutao
marked this pull request as ready for review
September 6, 2026 06:37
baozhoutao
deleted the
claude/issue-4853-flip-report-unused-disable-directives
branch
September 6, 2026 06:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4853
Second dispatch on this card: THE FLIP. The cleanup half landed as PR #7909; this PR is the switch itself.
What this changes
One top-level object in
eslint.config.jscarrying onlylinterOptionsand nofileskey:That is the whole diff (25 lines, 22 of them the comment explaining why). ⛔ No
--max-warnings, ⛔ no change to.github/workflows/lint.yml— both are explicitly out of scope by maintainer ruling (comment5536044589, decision batch #28).This is a severity change on a check already running, not a new check. ESLint v10.8.1 defaults this option to
'warn', so every stale directive was already reported on every CI run; it was inert only becauselint.yml:20deliberately sets no--max-warnings. Measured with--print-config: the option reads1before this PR and2after, on every path kind.The measurement that authorises the flip (ruling condition 2(a))
The ruling makes the flip conditional on a measured zero, re-measured at the implementing branch point — not read off
main. Method mirrors the first dispatch: all 47 of turbo's lint tasks (46 packagelintscripts +//#lint:root, confirmed byturbo run lint --dry=json) run directly from their own task directory with--report-unused-disable-directives-severity error --format json.797b39f68The re-measure is load-bearing, not ceremonial: the count went 0 to 2 in the 21 days after PR #4849, with nobody touching those lines.
--print-configon three path kindspackages/core/src/index.tspackages/components/src/custom/badge.tsxscripts/github-slug.mjsThe
.mjsrow is why the block carries nofileskey: every rule-bearing object in this config is scoped**/*.{ts,tsx}or narrower, so alinterOptionsplaced on any of them would miss everythinglint:rootwalks.Reverse verification — the card's own acceptance criterion
Implementation committed first; each leg plants
// eslint-disable-next-line no-debuggerabove a line that cannot trigger it, proves the mutation reached disk by grep count, runs lint, then restores under a trap with absolute paths..tsin a 117-rule populationapps/console/src/__tests__/bootSplash.test.ts:169(grep 0 to 1)169:5 error Unused eslint-disable directive (no problems were reported from 'no-debugger')658cba85equals HEAD's,git diff HEADempty, restored run exit 0.mjsin the ZERO-rule populationscripts/github-slug.mjs:45(grep 0 to 1)45:1 error Unused eslint-disable directive (no problems were reported from 'no-debugger')a70bea36equals HEAD's,git diff HEADempty, restored run exit 0Ablation — the red is caused by this diff, not by ESLint's default. Same planted directive at the same line, linted against
HEAD~1's config (0 hits forlinterOptions): exit 0,1 problem (0 errors, 1 warning). With this PR's config: exit 1,1 problem (1 error, 0 warnings). The delta is exactly this block.Interaction with #7908 (measured here, deliberately not repaired here)
#7908 records that
eslint.config.jsresolves zero rules for every.js/.mjs/.cjspath, solint:rootwalks 89 files against nothing. Leg B answers the open question that raised: yes, an unused directive on a zero-rule file goes red. Directive processing does not depend on any rule being configured — the directive names a rule, nothing is reported from it, so it is unused. So this flip is the one check that has real teeth on that population today. #7908 stays open and is untouched by this PR.Gates, each quoted from its own printed verdict line
Exit codes captured by redirect-then-capture, all at head
28f9f309a.turbo run lint --concurrency=2(pnpm lint)Tasks: 47 successful, 47 total·Cached: 0 cached, 47 total— fully uncached;turbo.jsondeclares$TURBO_ROOT$/eslint.config.jsas alintinput, so this diff invalidated all 46 package caches and//#lint:rootiscache: falsepnpm lint:root✖ 32 problems (0 errors, 32 warnings)pnpm lint:coverage✅ lint coverage: 46/46 packages linted, 0 with outstanding errors (0 total).pnpm check:control-bytes✅ check-control-bytes: OK (scanned 6401 tracked text file(s); skipped 85 binary).node scripts/check-changeset-presence.mjs✅ No source or published contract of a released package changed in this range, so no changeset is owed.— so this PR deliberately carries nonenode scripts/check-governed-queue-guard.mjs --test eslint.config.js✅ NOT GOVERNED — 1 path(s) checked against 5 governed surface(s); none matched.pnpm exec vitest runon the 6 test files that readeslint.config.jsTest Files 6 passed (6)·Tests 217 passed (217)Merge posture
domain:devx@ objectui seat: the flip lands in a merge-queue lull, because the one real cost is a red on someone else's in-flight PR whose diff makes an existing directive stale. The remedy for such a red is deleting the stale directive on that PR — the red names the exact file and line.The zero above is measured at this branch point only. Anything merged to
mainafterwards can reintroduce a stale directive, and it will red at the merge-queue rebuild rather than silently.Part of the ratchet started by #4833 / PR #4849 (49 directives cleared) and continued by PR #7909 (2 more). Related: #4835, #4850, #7908.
Generated by Claude Code